<template>
  <div class="all">
    <div class="top">
      <h2>大学生志愿者活动</h2>
        <RouterLink to="/usercenter" class="top_info">
          <div>
            <span class="bg"></span><span>李华</span>
          </div>
          <div>></div>
        </RouterLink>
    </div>
    <div class="header">
      <div>
        <RouterLink class="header_list" v-for="item in list" :to="`${item.path}`">
          <div></div>
          <p>{{ item.context }}</p>
        </RouterLink>
      </div>
    </div>
    <div class="content">
      <div class="content_header">
        <span>志愿活动</span>
        <RouterLink to="/actslist">查看更多》</RouterLink>
      </div>
        <div class="content_list" v-for="item in active">
            <div>
              <span>{{ item.status }}</span>
            </div>
            <p>
              {{ item.actname }}
              <span>
                  {{item.starttime}}至{{ item.endtime }}
              </span>
              <span>
                  {{ item.actword }}
              </span>
          </p>            
        </div>
    </div>
  </div>
</template>
<script setup>
import { ref ,onMounted } from 'vue';
import { getAct } from '@/api/volunteerApi.js'
let active=ref()
onMounted(async ()=>{
  let res=await getAct()  
  active.value=res
})

let list=ref([
{
    path:'actslist',
    context:'认领活动'
  },
  {
    path:'lovereport',
    context:'爱心报表'
  },
  {
    path:'servicerecords',
    context:'服务纪实'
  },
  {
    path:'myservice',
    context:'我的纪实'
  } 
  
])
</script>

<style scoped>

.all{
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-accent);
}
.top{
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  height: 130px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.2);
  border-bottom: 2px solid var(--primary-dark);
}
.top>h2{
  position: absolute;
  margin-top: -25px;
  color: var(--white);
  font-size: var(--font-xxl);
  font-weight: 600;
}
.top>a{
  /* 将a链接转变为块状 */
  display: block;
  width: 85%;
  height: 50px;
  background: linear-gradient(135deg, var(--white) 0%, var(--bg-secondary) 100%);
  position: absolute;
  top: 85px;
  border-radius: 10px;
  /* 取消下划线 */
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.1);
}
.bg{
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 1px solid var(--primary-color);
  background: url(@/assets/OIP-C.jpg) no-repeat center/contain;
  border-radius: 50%;
}
.top>a>div:nth-child(1){
  width: 100px;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  color: var(--text-primary);
}
.top>a>div:nth-child(2){
  margin-right: 10px;
  color: var(--primary-color);
  font-weight: bold;
}
.header{
  background-color: var(--bg-accent);
  height: 140px;
  display: flex;
  justify-content: center;
  align-items: center;  
}
.header>div{
  width: 90%;
  height: 70%;
  background: linear-gradient(135deg, var(--bg-accent) 0%, var(--white) 100%);
  border-radius: 10px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 20px;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.1);
}
.header_list{
  width: 65px;
  height: 70px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}
.header_list>div{
  width: 40px;
  height: 40px;
  background-color: var(--secondary-color);
  background: url(@/assets/icon.jpg) -20px -15px /200px 300px ;
}
.header_list>p {
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: 500;
}
.content{
  background-color: var(--bg-accent);
  flex: 1;
  padding-top: 10px;
}
.content_header{
  height: 30px;
  background-color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}
.content_header>span {
  color: var(--text-primary);
  font-weight: 600;
}
.content_header>a {
  color: var(--primary-color);
  font-size: var(--font-sm);
}
.content_list{
  height: 120px;
  background-color: var(--white);
  display: flex;
}
.content_list>div{
  width: 180px;
  height: 120px;
  background: url(@/assets/volunter-icon.jpg) no-repeat center;
  background-size: contain !important;
  overflow: hidden;
}
.content_list>div>span{
  display: inline-block;
  margin-top: 99px;
  background-color: var(--success-color);
  color: var(--white);
  padding: 2px 6px;
  border-radius: 15px;
  font-size: var(--font-xs);
  font-weight: 500;
}
.content_list>p{
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  color: var(--text-primary);
  padding-left: 4px;
  margin-left: 2px;
}
.content_list>p>span:nth-child(1) {
  font-weight: 600;
  font-size: var(--font-md);
}
.content_list>p>span:nth-child(2){
  display: inline-block;
  width: 80px;
  height: 20px;
  line-height: 20px;
  background-color: var(--accent-color);
  border-radius: 15px;
  text-align: center;
  font-size: var(--font-xs);
  color: var(--white);
  font-weight: 500;
}
.content_list>p>span:nth-child(3) {
  color: var(--text-secondary);
  font-size: var(--font-sm);
}
</style>